<div class="searchbox">
    <!-- <div class="searchbox_box">
         <div  class="searchbox_text"> 开始时间：</div>
         <div  class="searchbox_input"> <input type="text" class="datapick datapick1"   name="date1"> </div>
     </div>

     <div class="searchbox_box">
         <div  class="searchbox_text"> 结束时间：</div>
         <div  class="searchbox_input"><input type="text"   name="date2" class="datapick datapick2" > </div>
     </div>-->

    <!-- <div class="searchbox_box">
         <div  class="searchbox_text"> 订单号：</div>
         <div  class="searchbox_input"><input type="text" > </div>
     </div>-->

    <div class="searchbox_box">
        <div class="searchbox_text"> 订单号：</div>
        <div class="searchbox_input"><input type="text" name="orderid"></div>
    </div>
    <div class="searchbox_box">
        <div class="search_button am-btn am-btn-secondary  search"><img
                    src="<?php echo base_url(); ?>/public/assets/image/chazhao.png">查询
        </div>
    </div>
    <div class="searchbox_box">
        <div class="search_button am-btn am-btn-secondary "><img
                    src="<?php echo base_url(); ?>/public/assets/image/daochu.png">
            <a style="" class="excelout" href="<?php echo base_url() . "/Business/GetOrderListexcel/" . $taskid; ?>">导出记录</a>
        </div>
    </div>

</div>

<style>
    .config {
        padding: 5px;
    }
</style>

<div class="fbneirong">
    <!--  <div class="soso" style="margin-left: 10%">
          <p class="ycfg" style="margin-left: 60px;"><input type="text" name="orderid" class="am-form-field am-input-sm" placeholder="订单号" /></p>
          <p class="" > <div   style="margin-left: 20px;" class="am-btn am-btn-secondary am-radius search">查找</div></p>
          <p class="" > </p>
      </div>-->
    <form class="am-form am-g">
        <table width="100%" class="am-table am-table-radius am-table-striped am-table-hover">
            <thead>
            <tr class="am-success">
                <th class="table-check"><input type="checkbox"/></th>

                <th class="table-id">编号</th>
                <th class="table-id">处理时间</th>
                <!-- <th class="table-type">测试员账户</th>-->
                <th class="table-author am-hide-sm-only">录入价格</th>
                <th class="table-author am-hide-sm-only">每单数量</th>
                <th class="table-author am-hide-sm-only">实际付款价格</th>
                <th class="table-date am-hide-sm-only">订单号</th>
                <th class="table-date am-hide-sm-only">快递公司</th>
                <th class="table-date am-hide-sm-only">快递单号</th>
                <th class="table-date am-hide-sm-only">状态</th>
                <th class="table-date am-hide-sm-only">操作</th>
            </tr>
            </thead>
            <tbody class="impowdith">


            </tbody>
        </table>

        <!--  <div class="am-btn-group am-btn-group-xs">
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 删除</button>
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 上架</button>
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 下架</button>
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 移动</button>
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 新增</button>
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 保存</button>
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-archive"></span> 移动</button>
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-trash-o"></span> 删除</button>
          </div>-->


        <div id="Pagination" style="margin:20px auto" style="display:none"></div>

        <!--  <ul class="am-pagination am-fr">


          </ul>-->


        <hr/>

    </form>


</div>


</div>
</div>
</div>

<div class="foods">
    <ul>
        版权所有@2019.
    </ul>
    <dl>
        <a href="" title="返回头部" class="am-icon-btn am-icon-arrow-up"></a>
    </dl>
</div>
</body>
</html>


<script>


    var on_request = false;
    var type = 1;
    var page = 1;

    var taskid = '<?php  echo $taskid; ?>';


    $(".search").click(function () {
        getorderlist();
    });


    function setlisthtnml(data) {
        var html = "";


        /*  <a class="am-btn am-btn-default am-btn-xs am-text-success am-round am-icon-file" data-am-modal="{target: '#my-popups'}" title="添加子栏目"></a>*/
        if (data.list.length > 0) {
            $.each(data.list, function (key, value) {

                let action = '<div></div>';
                if (value.status == "完成") {
                    action = '<div style="width: 60%"><a href="javascript:;" class="tuikuan red" id="' + value.id + '" >申请退款</a></div>';
                }
                html = html +
                    '<tr><td><input type="checkbox" /></td>\n' +
                    '<td>' + value.id + '</td>\n' +
                    '<td>' + value.finishtime + '</td>\n' +
                    /*   '<td>'+value.hunter_name+'</td>\n'+*/
                    '<td>' + value.price + '</td>\n' +
                    '<td>' + value.number + '</td>\n' +
                    '<td>' + value.real_price + '</td>\n' +
                    '<td>' + value.orderid + '</td>\n' +
                    '<td>' + value.express + '</td>\n' +
                    '<td>' + value.expressorderid + '</td>\n' +
                    '<td>' + value.status + '</td>\n' +
                    '<td >' +
                    '<div class="tbody_action">' +
                    action +
                    '</div></td >' +

                    '</tr>';
            });
            $(".impowdith").html(html);
            $('#Pagination').show();
            tuikuan()
        } else {
            html += '<div style="width:100%;text-align:center;">暂无数据</div>';
            $(".impowdith").html(html);
            $('#Pagination').hide();
        }


    }


    getorderlist();

    function getorderlist() {
        var url = "<?php echo base_url(); ?>/Business/GetJdOrderList";
        var orderid = $("input[name='orderid']").val();
        var postdata = {
            'taskid': taskid,
            'orderid': orderid,
            'page': page,
            'epage': 10
        };
        $.post(url, postdata, function (data) {
            on_request = false;
            setlisthtnml(data);
            setPagination("Pagination", data.count, page, data.epage, function (clickPage) {
                page = parseInt(clickPage) + 1;
                getorderlist();
            });
        }, 'json');

    }

    function tuikuan() {
        $(".tuikuan").click(function () {
            let id = $(this).attr("id")
            layer.prompt({
                title: '请输入退款原因',
                btn: ['确定', '取消'] //按钮
            }, function (value, index, elem) {
                var url = "<?php echo base_url(); ?>/Business/refund";
                $.post(url, {
                    id: id,
                    remarks: value
                }, function (data) {
                    if (data.code == 0) {
                        layer.msg('申请提交成功', {icon: 1});
                        window.location.reload()
                    } else {
                        layer.msg(data.msg, {icon: 2});
                    }
                }, 'json');
            }, function () {

            });

        });
    }


</script>




